package com.cocotingo.snail.template.models;

import com.cocotingo.snail.template.TemplateSyntaxException;

public class ImportNode extends Node {
	
	private String packageName;
	
	public String getPackageName() {
		return packageName;
	}
	
	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}

	@Override
	public void validateNode() throws TemplateSyntaxException {
		if (packageName == null || packageName.isEmpty()) throw new TemplateSyntaxException(this, "ImportNode.packageName shouldn't be empty/null.");
	}

	@Override
	public Iterable<Node> children() {
		return Node.EMPTY_ITERABLE;
	}

	@Override
	protected String getXMLNodeName() {
		return "Import";
	}

	@Override
	protected String getXMLAttributes() {
		return String.format("package=\"%s\"", packageName);
	}

}
